Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MNT: switch from python2 style super() calls to python3 #1202

Merged
merged 1 commit into from
Mar 31, 2025

Conversation

nstelter-slac
Copy link
Collaborator

@nstelter-slac nstelter-slac commented Mar 15, 2025

The background on this patch is that running on pyside6 exposes some weirdness with how we are doing super() __init__ calls, so this comes as some cleanup before another fix that will follow.

these calls are equivalent (in python3):
python2 style: super(ClassName, self).__init__()
python3 style: super().__init__()

While these python2 style calls work on python3, the new way is cleaner and imo it's best to follow python3's conventions as we officially don't support python2.

references:
https://docs.python.org/3/library/functions.html#super
https://stackoverflow.com/a/19776143

@nstelter-slac nstelter-slac force-pushed the use_python3_super_calls branch from 5b3d13e to 1041426 Compare March 15, 2025 03:21
The background on this patch is that running on pyside6 exposes some weirdness which how we are doing super() __init__ calls, so this it comes as some cleanup before another fix that will follow.

python2 style: super(ClassName, self).__init__()
python3 style: super().__init__()

While these python2 style calls work on python3, the new way is cleaner and imo it's best to follow python3's conventions as we officially don't support python2.

references:
https://docs.python.org/3/library/functions.html#super
https://stackoverflow.com/a/19776143
@nstelter-slac nstelter-slac force-pushed the use_python3_super_calls branch from 1041426 to b9338a5 Compare March 15, 2025 03:25
@nstelter-slac nstelter-slac added the pyside6 for adding pyside6 (qt6) support label Mar 15, 2025
@nstelter-slac nstelter-slac changed the title MNT: switch away from python2 style super calls to python3 MNT: switch from python2 style super calls to python3 Mar 15, 2025
@nstelter-slac nstelter-slac changed the title MNT: switch from python2 style super calls to python3 MNT: switch from python2 style super() calls to python3 Mar 15, 2025
Copy link
Collaborator

@jbellister-slac jbellister-slac left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Each updated call looks good to me! Examples and test displays all still work as expected.

@nstelter-slac nstelter-slac requested a review from YektaY March 27, 2025 23:28
@YektaY YektaY merged commit af56a04 into slaclab:master Mar 31, 2025
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pyside6 for adding pyside6 (qt6) support
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants